package com.xiangyi.teachingsystem.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Message {
    //自增id
    @TableId(value = "id",type = IdType.AUTO)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer id;
    //小组标识
    @NotNull(message = "groupId不能为空")
    private Integer groupId;
    //用户标识
    @NotNull(message = "userId不能为空")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer userId;

    //用户的名字
    @TableField(exist = false)
    private String name;

    //信息
    @NotNull(message = "msg不能为空")
    private String msg;
    //发送的信息时间
    @NotNull(message = "msgTime不能为空")
    private Timestamp msgTime;
}
